<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <button onclick="onClick(this, event)">点击1</button>
    <script>
        const onClick = (button, event) => {
            alert('点击按钮');
            console.log(button, event);
            console.log(button.innerText);
        }
    </script>

    <button id="b2">点击2</button>
    <script>
        const b2 = document.getElementById('b2');
        b2.addEventListener('click', (e) => {
            alert('点击按钮');
            console.log(e);
            console.log(e.target);
            console.log(e.target.innerText);
        });
    </script>

</body>

</html>